package com.cuit.mapper;

import com.cuit.pojo.User;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface UserMapper {
    @Select("select * from user")
    public List<User> findAll();
    @Select("select * from user where id=#{id}")
    public User findById(int id);
    @Delete("delete from user where id = #{id}")
    public int deleteById(int id);
    @Insert("insert into user(name, password, head) values(#{name},#{password},#{head}) ")
    public int insertUser(User user);
    @Update("update user set name=#{name},password=#{password},head=#{head} where id=#{id}")
    public int updateById(User user);
    @Select("select * from user where name=#{name}")
    public User findByName(String name);
}
